/*
* 操作dom
* */
interface IToggleClass{
    cls: string
    targetDomOrClass: string
}
// 修改替换class
export const toggleClass = (params:IToggleClass) => {
  let { cls, targetDomOrClass } = params
  targetDomOrClass = targetDomOrClass || 'body'
  const classList = (document.querySelector(targetDomOrClass) as Element).classList
  if (classList === undefined) return
  classList.value = cls
}
// 添加class
export const addClass = (params:IToggleClass) => {
  const { cls, targetDomOrClass } = params
  const classList = (document.querySelector(targetDomOrClass) as Element).classList
  if (classList === undefined) return
  classList.add(cls)
}
// 删除class
export const removeClass = (params:IToggleClass) => {
  const { cls, targetDomOrClass } = params
  const classList = (document.querySelector(targetDomOrClass) as Element).classList
  if (classList === undefined) return
  classList.remove(cls)
}
